package cn.edu.sdu.sduhour.mapper;

import cn.edu.sdu.sduhour.entity.Tools;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface ToolsMapper {
    //查询此人所有的道具数量
    @Select("select * from tools where openid=#{openid}")
    List<Tools> findAll(Tools tools);

    //增加一条道具记录
    @Insert("INSERT INTO `tools` (`openid`,`skip`,`restart`) VALUES (#{openid},2,2)")
    void addOne(Tools tools);

    //更改一条道具记录
    @Update("UPDATE `sduhour`.`tools` SET ${changeName}=${changeName}+#{changeNum} WHERE openid=#{openid}")
    void changeOne(Tools tools);

    //删除一条道具记录
    @Delete("DELETE FROM `tools` WHERE `id` = #{id}")
    void delOne(Tools tools);
}
